﻿#include "SmartControl.h"
#include <QtWidgets/QApplication>
#include <QMainWindow>
#include <windows.h>
#include <dwmapi.h>
#pragma comment(lib, "dwmapi.lib")

// 设置原生标题栏颜色（Win10 1709+）
bool setNativeTitleBarColor(HWND hwnd, COLORREF color)
{
	if (!hwnd) return false;

	// Win10 1709+ 的属性值
	const DWORD DWMWA_CAPTION_COLOR = 35;
	HRESULT hr = DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &color, sizeof(color));
	return SUCCEEDED(hr);
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    SmartControl w;
    w.show();
	// 获取 Qt 窗口的原生 HWND 句柄
	HWND hwnd = reinterpret_cast<HWND>(w.winId());

	// 设置标题栏颜色（RGB）
	setNativeTitleBarColor(hwnd, RGB(56, 63, 81));  // 深灰色
    return a.exec();
}
